2026-09-22 · class-notes, a-plus, comptia, messer, networking, ip-addressing, dhcp, apipa
Full class notes for Professor Messer A+ 220-1201 objective 2.6: IP address, subnet mask and gateway; static addressing vs DHCP reservations; APIPA.
Class notes · Professor Messer, CompTIA A+ 220-1201 Core 1 · Section 2, objective 2.6
Quick reference: the short version of this lesson is the Assigning IP Addresses cheat sheet, part of Section 2. It follows the IPv4 and IPv6 lesson, which also covers objective 2.6, and builds on the DHCP lesson from objective 2.4.
By the end of these notes you should be able to:
Every device on a network needs its own IP address, such as 192.168.1.165. No two devices on the same network can share one. The address is either typed in by hand or supplied automatically.
An IP address on its own is not enough. The device also needs a subnet mask, such as 255.255.255.0, which tells it which part of the address identifies the network and which part identifies the host. The combination of an address and a mask defines the device's IP subnet: the range of addresses it can reach directly.
The mask is not something you can discover by watching traffic, because it is not carried in packets. It comes either from the network administrator or from the DHCP server, so if you configure it by hand, confirm it with whoever runs that subnet.
To reach anything outside its own subnet, a device needs the address of its local router, known as the default gateway, such as 192.168.1.1. The gateway must itself be inside the device's subnet, because the device has to be able to reach it directly.
The address, mask and gateway together are the minimum for a device to talk both to its own subnet and beyond it. An administrator will usually give you all three at once.
Many networks need more than the basic three:
| Setting | Why the device needs it |
|---|---|
| DNS servers | To turn names into IP addresses; without them, nothing works by name |
| NTP servers | To keep the clock accurate, which authentication and logging depend on |
| VoIP servers | So IP phones can find their call server |
| Others | Anything the network needs devices to know about, such as boot or proxy servers |
A device is configured with 192.168.1.165, mask 255.255.255.0 and gateway 192.168.1.1. For every packet, it performs a bitwise AND of an address with the mask, which keeps the network part and zeroes the host part.
This host: 192.168.1.165 mask 255.255.255.0 gateway 192.168.1.1
My network = 192.168.1.165 AND 255.255.255.0 = 192.168.1.0
Destination 192.168.1.20 Destination 192.168.2.20
AND 255.255.255.0 = 192.168.1.0 AND 255.255.255.0 = 192.168.2.0
Same as my network: LOCAL Different network: REMOTE
| |
v v
ARP for 192.168.1.20's MAC ARP for the gateway's MAC
and send the frame straight to it and send the frame to 192.168.1.1
192.168.1.165 AND 255.255.255.0 = 192.168.1.0.192.168.1.20: AND the mask gives 192.168.1.0, the same network. It is local, so the device finds its MAC address with ARP and sends to it directly.192.168.2.20: AND the mask gives 192.168.2.0, a different network. It is remote, so the device sends the frame to the gateway, which routes it onward.A mask of 255.255.255.0 (a /24) leaves 8 bits for hosts: 256 addresses, of which 254 can be used by devices (192.168.1.1 to 192.168.1.254). The first is the network address and the last, 192.168.1.255, is the broadcast address.
The administrator's settings are mask 255.255.255.0, but a technician types 255.255.0.0.
192.168.1.165 AND 255.255.0.0 = 192.168.0.0, a /16.192.168.2.20. With the wrong mask, 192.168.2.20 AND 255.255.0.0 = 192.168.0.0, so the device believes the server is local.192.168.2.20 instead of sending the traffic to the gateway. The server is on another subnet, so nobody answers.192.168.x.x, while other devices work fine. The only cure is to find and fix the typing mistake.This is why static settings must be entered exactly: nothing checks them for you.
Most devices get their settings from DHCP (the Dynamic Host Configuration Protocol, covered in the 2.4 DHCP lesson), which hands out addresses from a pool. Sometimes, though, a device should always have the same address. An address that never changes is a static IP address.
The most direct way to set one is to type it into the device's network settings: the IP address, subnet mask, default gateway, preferred DNS server and anything else the network needs. On Windows, that is the adapter's properties (reached with ncpa.cpl), PowerShell or netsh; section 6 has the commands.
Manual configuration has two weaknesses:
For those reasons, typing static settings into every device is generally not best practice.
A DHCP reservation gives a device a fixed address without configuring the device itself. On the DHCP server, an administrator links the device's MAC address to a specific IP address. The device stays set to DHCP. When it asks for an address, the server recognises its MAC address and always hands out the reserved one, along with the current gateway, DNS and other settings.
The result is the best of both: the address never changes, but everything is managed in one place. If the gateway or DNS servers change, you update the DHCP server, and every device picks up the new settings automatically.
Correction: the lesson says devices pick up new settings the next time they start. They also pick them up when they renew their lease, which clients normally try to do when half the lease time has passed, or immediately with
ipconfig /renew. A restart is not required.
A small office is reorganising its addressing. For each device, pick static, reservation or dynamic.
| Device | Choice | Reasoning |
|---|---|---|
| Staff laptops | Dynamic | Nobody needs to know their address; they move between networks |
| Network printer | Reservation | People and print servers need a fixed address, but settings should be central |
| IP phones | Dynamic (or reservation) | They find their call server through DHCP settings; a fixed address is optional |
| DHCP server | Static | It cannot get its own address from itself |
| Router (default gateway) | Static | Every device depends on it, often including DHCP itself |
| DNS server | Static | Clients are given its address, so it must never move |
Caution: the lesson suggests reservations are the more common choice for routers and switches. That suits many devices, but anything DHCP itself depends on, such as the DHCP server, the routers that relay DHCP requests, and DNS servers, is normally configured statically. Otherwise a DHCP outage could stop the very devices needed to fix it.
Most devices rely on DHCP. At home, at work, in a hotel or a coffee shop, your device almost certainly received its address automatically. The full sequence is shown here: what normally happens, and what the device does when no DHCP server answers.
Device starts, set to obtain an address automatically
|
v
Does a DHCP server answer? ---- no ----> Pick 169.254.x.y at random
| |
yes v
| ARP probe: is anyone using it?
v | |
Reservation for this MAC? reply silence
| | | |
yes no v v
| | pick another use it: APIPA
v v and try again (local only)
Same reserved Next free address
address, always from the pool
If a device is set to use DHCP but no DHCP server responds, it has to decide what to do on its own. Most operating systems give themselves an APIPA address.
APIPA stands for Automatic Private IP Addressing. It is Microsoft's name for what the standards call an IPv4 link-local address. With it, a device can talk to other devices on the same network segment that are also using link-local addresses, but it cannot be routed beyond that segment. There is no default gateway, so there is no internet access.
That limited connectivity is still useful. Devices on the same segment can reach each other, which helps with basic troubleshooting while you work out why DHCP isn't answering.
Note (beyond this lesson): Windows keeps trying to reach a DHCP server in the background, about every five minutes. If one appears, the device swaps its APIPA address for a proper one without any action from you. Other operating systems implement the same standard (RFC 3927), though not all enable it by default.
The standard reserves the whole 169.254.0.0/16 block for link-local addressing, but keeps the first and last 256 addresses back.
| Addresses | Status |
|---|---|
169.254.0.0 to 169.254.0.255 |
Reserved (first 256) |
169.254.1.0 to 169.254.254.255 |
Used for APIPA: 65,024 addresses |
169.254.255.0 to 169.254.255.255 |
Reserved (last 256) |
The usable range works out as 254 blocks of 256 addresses: 254 x 256 = 65,024.
Exam tip: any address starting
169.254means the device asked for DHCP and got no answer. Treat it as a symptom to investigate, not a configuration to keep.
A device picks its APIPA address at random from that large range, say 169.254.77.77. Before using it, it must make sure no other device already has it. It broadcasts an ARP request to the local subnet, effectively asking "is anyone using 169.254.77.77?" If nobody replies, it takes the address; if someone does, it picks another and tries again.
Note (beyond this lesson): these checks are called ARP probes. The device sends them with a sender IP address of
0.0.0.0, because it doesn't yet own an address, and sends several (the standard specifies three) before deciding the address is free.
In the real world: Linux's
arping -Dperforms exactly this check. On a Debian test machine, probing a free address and then an address in use gave:ARPING 192.0.2.77 from 0.0.0.0 eth0 Sent 2 probes (2 broadcast(s)) Received 0 response(s)ARPING 192.0.2.1 from 0.0.0.0 eth0 Unicast reply from 192.0.2.1 [02:FC:00:00:00:05] 0.652ms Sent 1 probes (1 broadcast(s)) Received 1 response(s)Silence means the address is free; a reply means it is taken. The addresses differ from APIPA's, but the mechanism is the same.
On Windows, ipconfig /all labels a self-assigned address as an Autoconfiguration IPv4 Address rather than an ordinary IPv4 address, and it will be in the 169.254 range with no default gateway. On Linux, ip addr shows it like any other address, so the 169.254 prefix is the giveaway.
A user reports "no internet". ipconfig /all shows 169.254.41.203 with no default gateway.
169.254 address means DHCP failed, so the problem is between the laptop and the DHCP server, not with the internet.ipconfig /release then ipconfig /renew. If a server answers now, the fault was temporary.169.254 addresses, the DHCP server itself (or the path to it) is down. If only this laptop does, look at its port, cable, VLAN or adapter.Windows PowerShell, static address:
New-NetIPAddress -InterfaceAlias 'Ethernet' -IPAddress 192.168.1.165 -PrefixLength 24 `
-DefaultGateway 192.168.1.1
Set-DnsClientServerAddress -InterfaceAlias 'Ethernet' -ServerAddresses 192.168.1.1
PowerShell takes the mask as a prefix length: 255.255.255.0 is /24, so -PrefixLength 24.
Windows command prompt, static and back to DHCP (^ continues a long line):
netsh interface ip set address name="Ethernet" static ^
192.168.1.165 255.255.255.0 192.168.1.1
netsh interface ip set dns name="Ethernet" static 192.168.1.1
netsh interface ip set address name="Ethernet" dhcp
netsh interface ip set dns name="Ethernet" dhcp
ipconfig /release
ipconfig /renew
Linux, temporary static settings (lost at reboot; permanent settings go in the distribution's network configuration):
sudo ip addr add 192.168.1.165/24 dev eth0
sudo ip route add default via 192.168.1.1
ip addr show dev eth0 # check the result
The GUI route on Windows is ncpa.cpl: open the adapter's properties, then Internet Protocol Version 4, and choose between "Obtain an IP address automatically" and "Use the following IP address".
| Method | Set where | Best for | Watch out for |
|---|---|---|---|
| Static (manual) | On the device | Core infrastructure: routers, DHCP and DNS servers | Typos; every change means visiting the device |
| DHCP reservation | On the DHCP server | Printers and other devices that need a fixed address | Depends on DHCP; tied to the MAC address, so replacing the NIC breaks it |
| Dynamic (DHCP) | On the DHCP server | Laptops, desktops, phones: most devices | The address may change over time |
| APIPA | The device itself | Nothing: it is an automatic fallback | A sign that DHCP failed |
169.254 addresses is worth investigating as a possible attack, not just an outage.169.254.1.0 to 169.254.254.255, after checking with ARP that it is free.169.254 address means DHCP failed.| Term | Meaning |
|---|---|
| APIPA | Automatic Private IP Addressing: a self-assigned 169.254 address used when DHCP fails |
| ARP probe | An ARP request sent to check whether an address is already in use |
| Default gateway | The local router a device sends traffic to for other subnets |
| DHCP | Dynamic Host Configuration Protocol: automatically hands out IP settings |
| DHCP reservation | A DHCP setting that always gives a particular MAC address the same IP address |
| DHCP pool | The range of addresses a DHCP server can hand out |
| Dynamic address | An address assigned by DHCP that may change over time |
| IP subnet | The range of addresses defined by an IP address and subnet mask together |
| IPv4 link-local address | The standard name for an APIPA-style 169.254 address |
| Lease | The period a DHCP-assigned address is valid before it must be renewed |
| MAC address | The hardware address of a network interface, used to identify a device for reservations |
| NTP | Network Time Protocol: keeps device clocks accurate |
| Prefix length | The number of network bits, such as /24 for 255.255.255.0 |
| Static address | An address that does not change, set manually or by reservation |
| Subnet mask | A value that marks which part of an address is the network, such as 255.255.255.0 |
192.168.1.165/24. Is 192.168.1.200 local or remote? What about 192.168.3.1?255.255.0.0 instead of 255.255.255.0. What symptom might the user see?169.254.10.5. What happened, and can it reach the internet?169.254 address. Where do you look first?/24 as a dotted subnet mask, and how many usable host addresses does it give?192.168.1.200 is local; 192.168.3.1 is remote. Only addresses in 192.168.1.0/24 are on the same subnet.192.168.x.x subnets. The device thinks those are local and never uses the gateway.169.254.1.0 to 169.254.254.255. The first and last 256 addresses of 169.254.0.0/16 are reserved.255.255.255.0; 254 usable hosts. 256 addresses, minus the network and broadcast addresses.